package com.example.mapper;

import com.example.entity.Admin;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface AdminMapper {
    List<Admin> selectAll(Admin admin);//他帮你创建好了，接着我们需要去xml里实现

    @Select("select * from admin where id = #{id}")
    Admin selectById(Integer id);//这里我们用基于注解@Select的方法查询,就不用xml了，但后面的关联查询建议用xml

    void insert(Admin admin);

    void updateById(Admin admin);

    @Delete("delete from `admin` where id = #{id}") //删除可以用基于注解
    void deleteById(Integer id);

    @Select("select * from admin where username = #{username}")
    Admin selectByUsername(String username);
}
